package com.etc.service.impl;

import static org.hamcrest.CoreMatchers.nullValue;

import java.util.List;

import com.etc.dao.impl.BussiteDaoImpl;
import com.etc.entity.BusSites;
import com.etc.entity.Bussite;
import com.etc.service.BussiteService;
import com.etc.util.PageData;
    /**
     * 中间站点增删改查业务层具体实现
     * @author xst
     *
     */
public class BussiteServiceImpl implements BussiteService {
	BussiteDaoImpl dao = new BussiteDaoImpl();

	/**
	 * 查询所有车辆站点信息
	 */
	@Override
	public List<Bussite> getBussites() {
		// TODO Auto-generated method stub
		return dao.queryBussites();
	}
	/**
	 * 根据车辆编号查询所有车辆站点信息
	 */
	@Override
	public List<Bussite> getBussitesByB_id(int b_id) {
		// TODO Auto-generated method stub
		return dao.queryBussitesByB_id(b_id);
	}
	/**
	 * 增加车辆站点信息
	 */
	@Override
	public boolean addBussite(Bussite bussite) {
		// TODO Auto-generated method stub
		if (bussite!=null) {//不为空
			BusSites bs = dao.queryBussite(bussite.getB_id(), bussite.getS_id(),bussite.getS_location() );
			if (bs==null) {
				return dao.addBussite(bussite);
			}
		}
		return false;
	}
	/**
	 * 修改车辆站点信息
	 */
	@Override
	public boolean updatBussite(Bussite bussite) {
		// TODO Auto-generated method stub
		return dao.updatBussite(bussite);
	}
	/**
	 * 删除车辆站点信息
	 */
	@Override
	public boolean deleBussite(int bs_id) {
		// TODO Auto-generated method stub
		return dao.deleBussite(bs_id);
	}
	/**
	 * 站点信息与中间站点关联表
	 */
	@Override
	public List<BusSites> queryAllbusSite() {
		List<BusSites> list = dao.queryAllbusSite();
		return list;
	}
	@Override
	public PageData queryLimtSite(int pageNo, int pageSize) {
		// TODO Auto-generated method stub
		return dao.queryLimtSite(pageNo, pageSize);
	}
	@Override
	public boolean deleBussite(int bs_id, int s_location) {
		// TODO Auto-generated method stub
		return dao.deleBussite(bs_id, s_location);
	}
	@Override
	public int queryBussiteId(int b_id, int s_location) {
		// TODO Auto-generated method stub
		return dao.queryBussiteId(b_id,s_location);
	}

}
